package com.sakiko.parameter.controller;

import dev.langchain4j.model.chat.ChatModel;
import dev.langchain4j.service.UserMessage;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * projectName: com.sakiko.parameter.controller
 *
 * @author: sakiko
 * time: 2025/8/24 13:10
 * description: 知识出处，https://docs.langchain4j.dev/tutorials/model-parameters/
 */
@RestController
@Slf4j
public class ModelParameterController {

    @Qualifier("chatModelQwen")
    @Autowired
    private ChatModel chatModelQwen;

    // http://localhost:9005/modelparam/config
    @GetMapping("modelparam/config")
    public String config(@RequestParam(value = "prompt", defaultValue = "3+10直接回答答案") String prompt) {
        String res = chatModelQwen.chat(prompt);
        System.out.println("res = " + res);
        return res;
    }
}
